﻿@{
    Layout = "~/Views/Samples/Generic/_Codebehind.cshtml";
}
@section cs_webforms_existing
{
        protected UploadSession UploadSession
        {
            get { return SlickUploadContext.CurrentUploadSession; }
        }

        protected void uploadButton_Click(object sender, EventArgs e)
        {
            if (UploadSession != null && UploadSession.State == UploadState.Complete)
            {
                if (UploadSession.UploadedFiles.Count > 0)
                {
                    resultsRepeater.DataSource = UploadSession.UploadedFiles;
                    resultsRepeater.DataBind();
                }
            }
        }

        protected void newUploadButton_Click(object sender, EventArgs e)
        {
            uploadResultPanel.Visible = false;
            uploadPanel.Visible = true;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (UploadSession != null)
            {
                uploadResultPanel.Visible = true;
                uploadPanel.Visible = false;
            }
        }
}
@section vb_webforms_existing {
    Protected ReadOnly Property UploadSession As UploadSession
        Get
            Return SlickUploadContext.CurrentUploadSession
        End Get
    End Property

    Protected Sub uploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uploadButton.Click
        If Not UploadSession Is Nothing AndAlso UploadSession.State = UploadState.Complete Then
            If UploadSession.UploadedFiles.Count > 0 Then
                resultsRepeater.DataSource = UploadSession.UploadedFiles
                resultsRepeater.DataBind()
            End If
        End If
    End Sub

    Protected Sub newUploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles newUploadButton.Click
        uploadResultPanel.Visible = False
        uploadPanel.Visible = True
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not UploadSession Is Nothing Then
            uploadResultPanel.Visible = true
            uploadPanel.Visible = false
        End If
    End Sub
}